package com.boot.cloud.sentinel;

import com.alibaba.csp.sentinel.adapter.servlet.callback.UrlCleaner;
import org.springframework.stereotype.Component;

@Component
public class UrlCleanerImpl implements UrlCleaner {
    @Override
    public String clean(String originUrl) {
        if (originUrl == null || originUrl.isEmpty()) {
            return originUrl;
        }
        // 比如将满足 /id/{id} 的 URL 都归到 /id/*
        if (originUrl.startsWith("/id/")) {
            return "/id/{id}";
        }
        return originUrl;
    }
}
